<!--
 * @Descripttion: 过滤器V2
 * @version: 2.2
 * @Author: sakuya
 * @Date: 2021年7月30日14:48:41
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @LastEditTime: 2023-07-02 09:40:20
-->

<template>
  <div class="FilterForm">

    <el-row>
      <!-- 输入框 -->
      <el-col :span="24" style="text-align: center">
        <skVxeFilterList :placeholder="params.item.itemRender.placeholder" v-model="contentValue"
          :multiple="params.multiple" :params="params" />
      </el-col>
    </el-row>

  </div>
</template>
<script>

import skVxeFilterList from "@/components/skVxeFilterList";
import XEUtils from "xe-utils";

export default {
  name: "filterBar",

  props: {
    params: Object,
    modelValue: null
  },
  components: {
    skVxeFilterList,
  },
  data() {
    return {
      contentValue: this.modelValue,
    };
  },

  watch: {
    modelValue(val) {
      this.contentValue = val;
    },
    contentValue(val) {
      const { data, field } = this.params;
      XEUtils.set(data, field, val);
      this.$emit("update:modelValue", val);
    }
  },
  mounted() {
    const { data, field, item } = this.params;
    data[field] = item.itemRender.defaultvalue;
  },

  methods: {
  },
};
</script>
<style scope>
.FilterForm {
  max-width: auto;
  margin: 5px;
}

.FilterForm .el-row {
  margin-bottom: 5px;
}
</style>
